//
//  PhotoDTO.swift
//  
//
//  Created by Jiang Chencheng on 2024/9/11.
//

import Fluent
import Vapor

struct PhotoDTO: Content  {
    var id: UUID?
    var name: String?
    var url: String?
    
    func toModel() -> Photo {
        let model = Photo()
        
        model.id = id
        
        if let name = self.name {
            model.name = name
        }
        
        if let url = self.url {
            model.url = url
        }
        
        return model
    }
}
